package com.java.yz.day04.homework;

//获取数组的最值（最大和最小）

public class ArrayText2 {
    public static void main(String[] args) {
        int[] arr1={2,4,6,1,22,54,676,44,221};
        int MinNub=arr1[0];
        int MaxNub=arr1[0];
        for (int i = 1; i < arr1.length; i++) {
            if (MinNub>arr1[i]){
                MinNub=arr1[i];
            }
            if (arr1[i]>MaxNub){
                MaxNub=arr1[i];
            }
        }
        System.out.println(MinNub);
        System.out.println(MaxNub);
    }
}
